package com.zy.模式匹配.样例类

object Test {
  def main(args: Array[String]): Unit = {

    // 直接复用 匹配对象.Test 下的代码
    val student: Student = new Student("张三", 12)

    // 对对象的内容进行匹配
    val str = student match {
      case Student("张三", 12) => "匹配成功"
      case _ => "匹配失败"
    }
    println(str)
  }
}

// 自动生成伴生对象的apply unapply方法
case class Student(name: String, age: Int)
